#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QToolBar>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QToolBar* t1 = new QToolBar();
    QToolBar* t2 = new QToolBar();

    this->addToolBar(t1);
    this->addToolBar(Qt::LeftToolBarArea, t2);

    // 只允许停靠在左侧或右侧
    t2->setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea);
    // 设置不允许浮动
    t2->setFloatable(false);
    // 设置不允许移动
    t2->setMovable(false);

    QAction* a1 = new QAction("动作1");
    QAction* a2 = new QAction("动作2");
    QAction* a3 = new QAction("动作3");
    QAction* a4 = new QAction("动作4");

    t1->addAction(a1);
    t1->addAction(a2);
    t2->addAction(a3);
    t2->addAction(a4);
}

MainWindow::~MainWindow()
{
    delete ui;
}

